{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb7}
		</small>
	</h1>
</div>
<div class="page-header">
	<a href="javascript:void(0);" onclick="topLeft();" class="btn btn-primary">新增</a>
</div>
<form action="{:url('Contract/open')}" method="get">
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>
				<input name="name" type="text" placeholder="输入用户名" value="{:input('param.name')}" />
				<input name="create_time" type="date" placeholder="输入时间" value="{:input('param.create_time')}" />
				<button class="btn btn-primary">查询</button>&nbsp;&nbsp;&nbsp;
				<a href="{:url('Contract/open')}" class="btn btn-primary">清空查询条件</a>
			</th>
		</tr>
		</thead>
	</table>
</form>
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>id</th>
						<th>姓名</th>
						<th>用户</th>
						<th>创建时间</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v"}
						<tr>						
							<td>{$v.id}</td>
							<td>{:get_member_idcardname($v.username)}</td>
							<td>{$v.username}</td>
							<td>{:date('Y-m-d',$v.create_time)}</td>
							<td>
								<a class="delete btn btn-xs btn-danger" href='{:url("Contract/del",array("model"=>"contract_open","id"=>$v["id"]))}' >
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
				</tbody>
			</table>
		</div>
		{$page}
	</div>
</div>
{/block}
{block name="javascript"}
<script>
	function topLeft(){
		var username = prompt("请输入用户名");
		if(username){
			$.ajax({
				url:"{:url('contract/record')}",
				data:{username:username},
				type:'post',
				success:function(data){
					alert(data.msg);
					setTimeout(function(){
						window.location.href = "open";
					},300);
				}
			});
		}
	}

	$(function(){
	   	$("#search").click(function () {
			var url = $(this).attr('url');
			var query = $('.search-form').find('input,select').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
			query = query.replace(/^&/g, '');
			if (url.indexOf('?') > 0) {
				url += '&' + query;
			} else {
				url += '?' + query;
			}
			window.location.href = url;
		});

		$("#search1").click(function () {
			var url = $(this).attr('url');
			var query = $('.search-form').find('input,select').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
			query = query.replace(/^&/g, '');
			if (url.indexOf('?') > 0) {
				url += '&' + query;
			} else {
				url += '?' + query;
			}
			//alert(url);
			window.location.href = url;
		});
	});
</script>
{/block}